package tech.aistar.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tech.aistar.entity.dynamic.Picture;

import java.util.List;

/**
 * Created by David on 2019/9/28.
 */
public interface PictureMapper {


    @Select("select * from picture")
    List<Picture> findAll();

    @Select("select * from picture where pic_id=#{value}")
    Picture getByPicId(Integer picId);


    void update(Picture picture);

    @Insert("insert into picture values(#{picId},#{userId},#{id},#{imgId},#{picType},#{picDate},#{picViews},#{picReport},#{picCollect}),#{picImg}")
    void addPicture(Picture picture);

    @Select("select * from picture where pic_type=#{value}")
    List<Picture> findByPicType(String picType);

    @Select("select * from picture where user_id=#{value}")
    List<Picture> findByUserId(Integer Id);

    @Update("update picture set pic_collect=1 where pic_id=#{value}")
    void delById(Integer id);
}
